package com.yawn.zerodefect.dao;

import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

/**
 * 练习使用redis
 * @author yawn
 * @date 2018-03-13 17:29
 */
@Repository
public class RedisDao {

    @Resource
    private StringRedisTemplate strRedisTpl;

    public void setStr(String key, String value) {
        strRedisTpl.opsForValue().set(key, value);
    }

    public String getStr(String key) {
        return strRedisTpl.opsForValue().get(key);
    }
}
